#include "geometry.h"

int main()
{
	int n, d;

	std::vector<int> answer;

	std::cin >> d;
	std::vector<double> coord(d);
	std::vector<double> length(d);
	std::vector<double> point(d);

	for (int i = 0; i < d; i++)
		std::cin >> coord[i];
	for (int i = 0; i < d; i++)
		std::cin >> length[i];

	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < d; j++)
			std::cin >> point[j];
		if (check(coord, length, point))
			answer.push_back(i + 1);
	}

	std::cout << answer.size() << "\n";
	for (size_t i = 0; i < answer.size(); i++)
		std::cout << answer[i] << " ";

	return 0;
}
